package net.caidingke.shepherd;

import io.ebean.SqlRow;
import net.caidingke.shepherd.domain.common.City;
import net.caidingke.shepherd.utils.result.ResultPage;

import java.util.List;
import java.util.Optional;

/**
 * @author bowen
 */
public interface LocationService {

    /**
     * get the city list.
     *
     * @param page     page number
     * @param pageSize page size
     * @return city list
     */
    ResultPage cities(int page, int pageSize);

    /**
     * create city.
     *
     * @param name city name
     */
    void createCity(String name);

    /**
     * get the city by id.
     *
     * @param id city id
     * @return city
     */
    Optional<City> findCityById(Long id);

    /**
     * update city by id.
     *
     * @param id   city id
     * @param name city name
     * @return city
     */
    Optional<City> modifyCity(Long id, String name);

    /**
     * native.
     *
     * @return sql row
     */
    List<SqlRow> selectNative();
}
